import 'package:xinxuan/vo/common_vo/common_pagination_vo.dart';

class IntegralListVo {

  List<IntegralItem>? data;
  IntegralMeta? meta;

  IntegralListVo({this.data, this.meta});

  IntegralListVo.fromJson(Map<String, dynamic> json) {
    if (json['data'] != null) {
      data = <IntegralItem>[];
      json['data'].forEach((v) {
        data!.add(new IntegralItem.fromJson(v));
      });
    }
    meta = json['meta'] != null ? new IntegralMeta.fromJson(json['meta']) : null;
  }

  Map<String, dynamic> toJson() {
    final Map<String, dynamic> data = new Map<String, dynamic>();
    if (this.data != null) {
      data['data'] = this.data!.map((v) => v.toJson()).toList();
    }
    if (this.meta != null) {
      data['meta'] = this.meta!.toJson();
    }
    return data;
  }
}

class IntegralItem {
  int? id;
  String? typeStr;
  int? type;
  String? integral;
  int? operator;
  String? createdAt;

  IntegralItem({this.id, this.typeStr, this.type, this.integral, this.operator, this.createdAt});

  IntegralItem.fromJson(Map<String, dynamic> json) {
    id = json['id'];
    typeStr = json['type_str'];
    type = json['type'];
    integral = json['integral'];
    operator = json['operator'];
    createdAt = json['created_at'];
  }

  Map<String, dynamic> toJson() {
    final Map<String, dynamic> data = new Map<String, dynamic>();
    data['id'] = this.id;
    data['type_str'] = this.typeStr;
    data['type'] = this.type;
    data['integral'] = this.integral;
    data['operator'] = this.operator;
    data['created_at'] = this.createdAt;
    return data;
  }
}

class IntegralMeta {
  IntegralStats? stats;
  CommonPagination? pagination;

  IntegralMeta({this.stats, this.pagination});

  IntegralMeta.fromJson(Map<String, dynamic> json) {
    stats = json['stats'] != null ? new IntegralStats.fromJson(json['stats']) : null;
    pagination = json['pagination'] != null
        ? new CommonPagination.fromJson(json['pagination'])
        : null;
  }

  Map<String, dynamic> toJson() {
    final Map<String, dynamic> data = new Map<String, dynamic>();
    if (this.stats != null) {
      data['stats'] = this.stats!.toJson();
    }
    if (this.pagination != null) {
      data['pagination'] = this.pagination!.toJson();
    }
    return data;
  }
}

class IntegralStats {
  int? available;
  int? used;
  int? expired;

  IntegralStats({this.available, this.used, this.expired});

  IntegralStats.fromJson(Map<String, dynamic> json) {
    available = json['available'];
    used = json['used'];
    expired = json['expired'];
  }

  Map<String, dynamic> toJson() {
    final Map<String, dynamic> data = new Map<String, dynamic>();
    data['available'] = this.available;
    data['used'] = this.used;
    data['expired'] = this.expired;
    return data;
  }
}

class Pagination {
  int? total;
  int? count;
  int? perPage;
  int? currentPage;
  int? totalPages;

  Pagination(
      {this.total,
      this.count,
      this.perPage,
      this.currentPage,
      this.totalPages});

  Pagination.fromJson(Map<String, dynamic> json) {
    total = json['total'];
    count = json['count'];
    perPage = json['per_page'];
    currentPage = json['current_page'];
    totalPages = json['total_pages'];
  }

  Map<String, dynamic> toJson() {
    final Map<String, dynamic> data = new Map<String, dynamic>();
    data['total'] = this.total;
    data['count'] = this.count;
    data['per_page'] = this.perPage;
    data['current_page'] = this.currentPage;
    data['total_pages'] = this.totalPages;
    return data;
  }
}
